﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Wix.Aura.Common.CustomTypes;

namespace Wix.Aura.Common {
	public class Shortcut : IXmlSerializable {
		private Shortcut() { }
		public Shortcut(string id, LongFileNameType name) {
			Id = id;
			Name = name;
			Icons = new List<Icon>();
			ShortcutProperty = new List<ShortcutProperty>();
		}

		public string Id { get; set; }
		public YesNoType Advertise { get; set; }
		public string Arguments { get; set; }
		public string Description { get; set; }
		public string DescriptionResourceDll { get; set; }
		public int? DescriptionResourceId { get; set; }
		public string Directory { get; set; }
		public string DisplayResourceDll { get; set;}
		public int? DisplayResourceId { get; set; }
		public int? Hotkey { get; set; }
		public string Icon { get; set; }
		public int? IconIndex { get; set; }
		public LongFileNameType LongName { get; set; }
		public LongFileNameType Name { get; set; }
		public ShortFileNameType? ShortName { get; set; }
		public Show? Show { get; set; }
		public string Target { get; set; }
		public string WorkingDirectory { get; set;}

		public ICollection<Icon> Icons { get; set; }
		public ICollection<ShortcutProperty> ShortcutProperty { get; set; }


		public System.Xml.Schema.XmlSchema GetSchema() {
			throw new NotImplementedException();
		}

		public void ReadXml(System.Xml.XmlReader reader) {
			throw new NotImplementedException();
		}

		public void WriteXml(System.Xml.XmlWriter writer) {
			writer.WriteStartElement("Shortcut");
			writer.WriteAttribute("Id", Id);
			writer.WriteAttribute("Advertise", Advertise);
			writer.WriteAttribute("Arguments", Arguments);
			writer.WriteAttribute("Description", Description);
			writer.WriteAttribute("DescriptionResourceDll", DescriptionResourceDll);
			writer.WriteAttribute("DescriptionResourceId", DescriptionResourceId);
			writer.WriteAttribute("Directory", Directory);
			writer.WriteAttribute("DisplayResourceDll", DisplayResourceDll);
			writer.WriteAttribute("DisplayResourceId", DisplayResourceId);
			writer.WriteAttribute("Hotkey", Hotkey);
			writer.WriteAttribute("Icon", Icon);
			writer.WriteAttribute("IconIndex", IconIndex);
			writer.WriteAttribute("LongName", LongName);
			writer.WriteAttribute("Name", Name);
			writer.WriteAttribute("ShortName", ShortName);
			writer.WriteAttribute("Show", Show);
			writer.WriteAttribute("Target", Target);
			writer.WriteAttribute("WorkingDirectory", WorkingDirectory);
			writer.WriteElements(Icons);
			writer.WriteElements(ShortcutProperty);
			writer.WriteEndElement();
		}
	}
}
